package wator.view.swing.jogl;

import wator.model.Integer2DVector;
import wator.model.Integer3DVector;
import wator.model.IntegerVector;

/**
 * This factory converts a two dimensional vector into a three dimensional
 * vector by setting the z-coordinate to zero.
 */
public class JoglVectorFactory2D implements JoglVectorFactory {

	/**
	 * Sets the z-coordinate to zero, transfers other values from v. Throws
	 * an exception if v is not two dimensional.
	 * {@inheritDoc}
	 */
	@Override
	public Integer3DVector generateVector(IntegerVector v) {
		return new Integer3DVector(
				((Integer2DVector) v).getX(),
				((Integer2DVector) v).getY(), 0);
	}
}